<template>
    <el-container style="user-select: none; height: 100vh;">
        <el-header>
            <div><img src="../../assets/1.png" class="image"></div>
            <div class="log-font">抖阳创作者中心</div>
        </el-header>
        <el-container>
            <el-aside width="160px" style="height: 100%; border-right: 1px solid #dcdcdc;">
                <el-menu router :default-active="path">
                    <el-menu-item index="/author/home">
                        <el-icon style="font-size: 26px;"><House /></el-icon>
                        <span style="margin-left: 5px;"> 首页</span>
                    </el-menu-item>

                    <el-menu-item index="/author/createWork">
                        <el-icon style="font-size: 26px;"><EditPen /></el-icon>
                        <span style="margin-left: 5px;"> 创建作品</span>
                    </el-menu-item>

                    <el-menu-item index="/author/works">
                        <el-icon style="font-size: 26px;"><TrophyBase /></el-icon>
                        <span style="margin-left: 5px;"> 作品管理</span>
                    </el-menu-item>

                    <el-menu-item index="/author/reviewing">
                        <el-icon style="font-size: 26px;"><MoreFilled /></el-icon>
                        <span style="margin-left: 5px;"> 审核管理</span>
                    </el-menu-item>

                </el-menu>
            </el-aside>

            <el-main>
                <div>
                    <RouterView />
                </div>
            </el-main>
        </el-container>
    </el-container>
</template>

<script setup lang="ts">
    import { useRouter } from "vue-router";
    const router=useRouter()
    import { onMounted } from "vue";
    import { RouterView,useRoute } from "vue-router";
    import checkLogin from "@/utils/checkLogin";
import { ElMessage } from "element-plus";
    let html = document.documentElement;
    const path=useRoute().path



    onMounted(async() => {
        html.className = 'dark';
        const result=await checkLogin();
        if(!result){
            ElMessage.error('请先登录')
            router.push('/')
        }
    });
</script>

<style scoped>
    .image {
        width: 40px;
        float: left;
    }

    .log-font {
        font-size: 20px;
        font-weight: 600;
        margin-left: 15px;
        margin-top: 6px;
        float: left;
    }  
</style>